﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UDIServer
{
    public partial class Msg : Form
    {
        Form p;

        public bool IsShow = false;
        public Msg(Form pf)
        {
            InitializeComponent();
            p = pf;
            FormClosed += Msg_FormClosed;
        }

        private void Msg_FormClosed(object sender, FormClosedEventArgs e)
        {
            IsShow = false;
        }

        public void Show(string msg)
        {
            lblMsg.Text = msg;
            IsShow = true;
            if(!this.Visible)
            {
                this.p.Invoke(new Action(() =>
                {
                    ShowDialog();
                }));
            }


        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
